import { useState } from 'react';
import { BrowserRouter } from 'react-router-dom';
import Routes from './Routes';
import MenuContext from './context/MenuContext';


const App = () => {
  const [menu, setMenu] = useState(JSON.parse(sessionStorage.getItem('menu') || '[]'));

  return (
    <MenuContext.Provider value={{
      menu,
      setMenu: (menu: any) => {
        setMenu(menu);
        sessionStorage.setItem('menu', JSON.stringify(menu));
      }
    }}>
      <BrowserRouter>
        <Routes />
      </BrowserRouter>
    </MenuContext.Provider>
  );
};

export default App;
